﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl2.ascx.cs" Inherits="UCWebpart.WebUserControl2" %>
<%@ Register Src="~/ResourceControl.ascx" TagPrefix="uc1" TagName="ResourceControl" %>

<uc1:ResourceControl runat="server" ID="ResourceControl" />

<p style="height: 25px">
    <br />
</p>
<p style="height: 25px">
    <br />
</p>

<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" DataKeyNames="mtrId" OnRowCommand="GridView1_RowCommand">
    <Columns>
        <asp:TemplateField>
             <HeaderTemplate>
                            <asp:Button ID="Button1" runat="server" CommandName="Insert" Text="Insert" />
                        </HeaderTemplate>
            <EditItemTemplate>
                <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update" Text="更新"></asp:LinkButton>
                &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel" Text="取消"></asp:LinkButton>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit" Text="编辑"></asp:LinkButton>
                &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Delete" Text="删除"></asp:LinkButton>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="mtrId" HeaderText="mtrId" ReadOnly="True" SortExpression="mtrId" />
        <asp:BoundField DataField="mtrName" HeaderText="mtrName" SortExpression="mtrName" />
        <asp:BoundField DataField="mtrPhone" HeaderText="mtrPhone" SortExpression="mtrPhone" />
        <asp:BoundField DataField="mtrPhoto" HeaderText="mtrPhoto" SortExpression="mtrPhoto" />
        <asp:CheckBoxField DataField="mtrState" HeaderText="mtrState" SortExpression="mtrState" />
        <asp:BoundField DataField="mtrLongestAdvanceBookingTime" HeaderText="mtrLongestAdvanceBookingTime" SortExpression="mtrLongestAdvanceBookingTime" />
        <asp:BoundField DataField="mtrFreeTime" HeaderText="mtrFreeTime" SortExpression="mtrFreeTime" />
    </Columns>
    <EmptyDataTemplate>
        <asp:DetailsView ID="DetailsView2" runat="server" AllowPaging="True" AutoGenerateRows="False" DataKeyNames="mtrId" DataSourceID="EntityDataSource1" DefaultMode="Insert" Height="50px" OnItemDeleting="DetailsView2_ItemDeleting" OnItemInserted="DetailsView2_ItemInserted" OnPageIndexChanging="DetailsView2_PageIndexChanging" Width="125px">
            <Fields>
                <asp:BoundField DataField="mtrId" HeaderText="mtrId" ReadOnly="True" SortExpression="mtrId" />
                <asp:BoundField DataField="mtrName" HeaderText="mtrName" SortExpression="mtrName" />
                <asp:BoundField DataField="mtrLevel" HeaderText="mtrLevel" SortExpression="mtrLevel" />
                <asp:BoundField DataField="mtrRUC" HeaderText="mtrRUC" SortExpression="mtrRUC" />
                <asp:BoundField DataField="mtrAddress" HeaderText="mtrAddress" SortExpression="mtrAddress" />
                <asp:BoundField DataField="mtrCapacity" HeaderText="mtrCapacity" SortExpression="mtrCapacity" />
                <asp:BoundField DataField="mtrPhone" HeaderText="mtrPhone" SortExpression="mtrPhone" />
                <asp:BoundField DataField="mtrType" HeaderText="mtrType" SortExpression="mtrType" />
                <asp:BoundField DataField="mtrFreeTime" HeaderText="mtrFreeTime" SortExpression="mtrFreeTime" />
                <asp:BoundField DataField="mtrPhoto" HeaderText="mtrPhoto" SortExpression="mtrPhoto" />
                <asp:CheckBoxField DataField="mtrState" HeaderText="mtrState" SortExpression="mtrState" />
                <asp:BoundField DataField="mtrLongestBookingDay" HeaderText="mtrLongestBookingDay" SortExpression="mtrLongestBookingDay" />
                <asp:BoundField DataField="mtrLongestAdvanceBookingTime" HeaderText="mtrLongestAdvanceBookingTime" SortExpression="mtrLongestAdvanceBookingTime" />
                <asp:BoundField DataField="mtrLastUser" HeaderText="mtrLastUser" SortExpression="mtrLastUser" />
                <asp:BoundField DataField="mtrLastTime" HeaderText="mtrLastTime" SortExpression="mtrLastTime" />
                <asp:CheckBoxField DataField="mtrDelete" HeaderText="mtrDelete" SortExpression="mtrDelete" />
                <asp:BoundField DataField="undefine2" HeaderText="undefine2" SortExpression="undefine2" />
                <asp:BoundField DataField="undefine3" HeaderText="undefine3" SortExpression="undefine3" />
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowInsertButton="True" />
            </Fields>
        </asp:DetailsView>
    </EmptyDataTemplate>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:meetingroomManagementConnectionString %>" DeleteCommand="DELETE FROM [MTR_bas_Meetingroom] WHERE [mtrId] = @mtrId" InsertCommand="INSERT INTO [MTR_bas_Meetingroom] ([mtrId], [mtrName], [mtrPhone], [mtrPhoto], [mtrState], [mtrLongestAdvanceBookingTime], [mtrFreeTime]) VALUES (@mtrId, @mtrName, @mtrPhone, @mtrPhoto, @mtrState, @mtrLongestAdvanceBookingTime, @mtrFreeTime)" SelectCommand="SELECT [mtrId], [mtrName], [mtrPhone], [mtrPhoto], [mtrState], [mtrLongestAdvanceBookingTime], [mtrFreeTime] FROM [MTR_bas_Meetingroom]" UpdateCommand="UPDATE [MTR_bas_Meetingroom] SET [mtrName] = @mtrName, [mtrPhone] = @mtrPhone, [mtrPhoto] = @mtrPhoto, [mtrState] = @mtrState, [mtrLongestAdvanceBookingTime] = @mtrLongestAdvanceBookingTime, [mtrFreeTime] = @mtrFreeTime WHERE [mtrId] = @mtrId">
    <DeleteParameters>
        <asp:Parameter Name="mtrId" Type="Int32" />
    </DeleteParameters>
    <InsertParameters>
        <asp:Parameter Name="mtrId" Type="Int32" />
        <asp:Parameter Name="mtrName" Type="String" />
        <asp:Parameter Name="mtrPhone" Type="String" />
        <asp:Parameter Name="mtrPhoto" Type="String" />
        <asp:Parameter Name="mtrState" Type="Boolean" />
        <asp:Parameter Name="mtrLongestAdvanceBookingTime" Type="String" />
        <asp:Parameter Name="mtrFreeTime" Type="String" />
    </InsertParameters>
    <UpdateParameters>
        <asp:Parameter Name="mtrName" Type="String" />
        <asp:Parameter Name="mtrPhone" Type="String" />
        <asp:Parameter Name="mtrPhoto" Type="String" />
        <asp:Parameter Name="mtrState" Type="Boolean" />
        <asp:Parameter Name="mtrLongestAdvanceBookingTime" Type="String" />
        <asp:Parameter Name="mtrFreeTime" Type="String" />
        <asp:Parameter Name="mtrId" Type="Int32" />
    </UpdateParameters>
</asp:SqlDataSource>
<asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=meetingroomManagementEntities" DefaultContainerName="meetingroomManagementEntities" EnableFlattening="False" EntitySetName="MTR_bas_Meetingroom" EnableDelete="True" EnableInsert="True" EnableUpdate="True" EntityTypeFilter="MTR_bas_Meetingroom">
</asp:EntityDataSource>
<asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px">
</asp:DetailsView>

